function scheduleHtmlParser(data) {
    data = eval(data)
    log('data原始长度', data.length)
    let item, result = [], hashArr = [], hash
    log('scheduleHtmlParser', data)
    for (let i = 0; i < data.length; i++) {
        item = data[i]
        item = JSON.parse(item)[0]['item']
        item = getCourseInfos(item)
        //课程去重(好像)
        for (let j = 0; j < item.length; j++) {
            hash = JSON.stringify(item[j])
            hash = hash.hashCode()
            if (hashArr.join('.').indexOf(hash) == -1) {
                log('新')
                hashArr.push(hash)
                result.push(item[j])
            } else {
                log('旧')
            }
        }
    }
    log(result)
    return result
}

//这里的data存放了一周的课程安排，说明有所变动，以前是只有一天的课程安排
function getCourseInfos(data) {
    log('getCourseInfos', data)
    let courseInfos = [],
        courseInfo, item, info
    for (i2 = 0, l2 = data.length; i2 < l2; i2++) {
        item = data[i2]//这里取出的就是一天的课程
        //info = handleDayAndSection(item.classTime, item.startTime, item.endTIme)
        if(item.length == 0) continue//这一天0节课
        log('==================')
        log(i2)
        log(item)
        log(item.length)
        log('==================')
        //231029新增，再加一个循环，目的是取出所有当天课再传入，而不是以前的直接传导致报错
        for(i3 = 0, l3 = item.length; i3 < l3; i3++) {
            s = item[i3][0]
            log('课程源信息', s)
            info = handleDayAndSection(s.classTime)
            courseInfo = {
                name: s.courseName,
                position: s.location,
                teacher: s.teacherName,
                weeks: handleWeeks(s.classWeekDetails),
                day: info[0],
                sections: info[1]
            }
            courseInfos.push(courseInfo)
        }
    }
    return courseInfos
}

function handleWeeks(data) {
    let weeks = []
    data = data.split(",")
    data = data.filter(function (s) {
        return s && s.trim()
    }) //去空
    for (i1 = 0, l1 = data.length; i1 < l1; i1++) {
        weeks.push(parseInt(data[i1]))
    }
    return weeks
}

//function handleDayAndSection(data, startTime, endTime) {
function handleDayAndSection(data) {
    let sections = [],
        day, section
    log('==================')
    log(data)
    log(data.length)
    log('==================')
    day = data.substring(0, 1)
    //单节判定
    if (data.length == 3) {
        log('单节课')
        let sing = data.substring(1, 3)
        sing = parseInt(sing)
        /* section = {
            section: sing,
            startTime: startTime,
            endTime: endTime
        } */
        sections.push(sing)
        return [day, sections]
    }
    log('双节课')
    let sectionS = data.substring(1, 3)
    let sectionE = data.substring(3, 5)
    day = parseInt(day)
    sectionS = parseInt(sectionS)
    sectionE = parseInt(sectionE)

    /* section = {
        section: [sectionS, sectionE],
        startTime: startTime,
        endTime: endTime
    } */
    sections.push(sectionS)
    sections.push(sectionE)
    return [day, sections]
}

//去除重复
function unique(arr) {
    let hash = [];
    for (let i = 0; i < arr.length; i++) {
        if (hash.indexOf(arr[i]) === -1) {
            hash.push(arr[i]);
        }
    }
    return hash;
}

//hash
String.prototype.hashCode = function () {
    if (Array.prototype.reduce) {
        return this.split("").reduce(function (a, b) { a = ((a << 5) - a) + b.charCodeAt(0); return a & a }, 0);
    }
    var hash = 0;
    if (this.length === 0) return hash;
    for (var i = 0; i < this.length; i++) {
        var character = this.charCodeAt(i);
        hash = ((hash << 5) - hash) + character;
        hash = hash & hash; // Convert to 32bit integer
    }
    return hash;
}

function log(tag, ct) {
    if (ct == undefined)
        console.info(tag)
    else
        console.info(tag, ct)
}